import request from '@/utils/request'

// 统一前缀
var prefix = '/userService'

//查询所有角色
export function lookAllRole() {
  return request({
    url: `${prefix}/role/listAll`,
    method: 'GET',
  })
}

//条件查询角色
export function lookRole(role) {
  return request({
    url: `${prefix}/role/list`,
    method: 'GET',
    params: role,
  })
}

//添加一条角色
export function insertOneRole(role) {
  return request({
    url: `${prefix}/role`,
    method: 'POST',
    data: role,
  })
}

//修改角色
export function updateOneRole(role) {
  return request({
    url: `${prefix}/role`,
    method: 'PUT',
    data: role,
  })
}

//删除角色
export function deleteRole(ids) {
  return request({
    url: `${prefix}/role`,
    method: 'DELETE',
    data: ids,
  })
}

//绑定权限到角色
export function bindPermission(map) {
  return request({
    url: `${prefix}/role/bind`,
    method: 'POST',
    data: map,
  })
}

//解绑权限到角色
export function unbindPermission(map) {
  return request({
    url: `${prefix}/role/unbind`,
    method: 'DELETE',
    data: map,
  })
}
